Skip to content

HTML API: Reconsume script data less-than tokens#56

Open
sirreal wants to merge 1 commit into
trunkfrom
fix/script-less-than-normalize
Open

HTML API: Reconsume script data less-than tokens#56
sirreal wants to merge 1 commit into
trunkfrom
fix/script-less-than-normalize

Conversation

@sirreal

@sirreal sirreal commented Jun 11, 2026

Copy link
Copy Markdown
Owner

What changed

Updates WP_HTML_Tag_Processor::skip_script_data() so a non-matching byte after < in script data is reconsumed instead of skipped.

Adds regression coverage for normalize() and tag parsing cases such as <script><</script> and <script></</script>, plus related less-than sequences before the real closer.

Why

The parser was advancing past the byte after < when the sequence was not a script end tag. If that byte was itself another < starting the real </script> closer, the parser skipped over the closer and later reported the document as paused at an incomplete token. normalize() then dropped the script element.

Validation

  • WP_TESTS_SKIP_INSTALL=1 ./vendor/bin/phpunit --group html-api --filter 'test_special_text_less_than_sequences_before_closer_are_not_incomplete|test_script_tag_parsing' -> OK, 45 tests, 83 assertions
  • ./vendor/bin/phpcs --standard=phpcs.xml.dist src/wp-includes/html-api/class-wp-html-tag-processor.php tests/phpunit/tests/html-api/wpHtmlProcessor-serialize.php tests/phpunit/tests/html-api/wpHtmlTagProcessor.php -> OK
  • Worker run also reported WP_TESTS_SKIP_INSTALL=1 ./vendor/bin/phpunit --group html-api,html-api-html5lib-tests -> OK, 2917 tests, 6182 assertions, 421 skipped

@sirreal sirreal changed the title [codex] HTML API: Reconsume script data less-than tokens HTML API: Reconsume script data less-than tokens Jun 12, 2026
@sirreal sirreal marked this pull request as ready for review June 12, 2026 06:19
@github-actions

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props jonsurrell.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant